
let state;
function useState(initialState){
    state = state||initialState;
    function setState(fn){
        //在setState里一方面要计算新状态，另外一方面状态计算完成后要重新渲染组件
        state=fn(state)
        TextInputWithFocusButton();
    }
    return [state,setState];
}

function TextInputWithFocusButton(){
    let [count,setState] = useState(0);
    console.log(count)
    setState(state=>state+1)
}
TextInputWithFocusButton();